﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms;

namespace pufflesweb
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            PF.SessionHelper.SetSession("user", null);//清空之前的用户信息
            string Username = this.username.Text;
            int Upassword = int.Parse(this.password.Text);

            if (PBLL.User.Login(Username, Upassword)==true)
            {
                PModel.User user = PBLL.User.Getuser(Username);
                PF.SessionHelper.SetSession("user", user);//保存当前用户登录信息
                PF.JsHelper.AlertAndParentUrl("登录成功", "index.aspx");
            }
            else
            {
                PF.JsHelper.AlertAndParentUrl("登录失败", "login.aspx");
            }
        }
    }
}